package com.yushu;

import org.apache.commons.collections.CollectionUtils;
import org.apache.tiles.request.collection.CollectionUtil;

import java.sql.Timestamp;
import java.text.DecimalFormat;
import java.util.*;

public class test {
    public static List<Integer> temp(List<Integer> list1, List<Integer> list2) {

        List<Integer> different = new ArrayList<Integer>();
        List<Integer> maxList = list1;
        List<Integer> minList = list2;
        if (list2.size() > list1.size()) {
            maxList = list2;
            minList = list1;
        }
        Map<Integer, Integer> map = new HashMap<Integer, Integer>(maxList.size());
        for (Integer Integer : maxList) {
            map.put(Integer, 1);
        }
        for (Integer Integer : minList) {
            if (null!=map.get(Integer)) {
                //当前小集合元素在大集合内存在
                // 大集合元素对应在map中的key-value的值改为2（标明该元素是共有元素）
                map.put(Integer, 2);
                continue;
            }
            //当前小集合元素在大集合内不存在
            //将该元素存入different
            different.add(Integer);
        }
        for (Map.Entry<Integer, Integer> entry : map.entrySet()) {
            //判断大集合内非共有元素
            //将元素存入different
            if (entry.getValue() == 1) {
                different.add(entry.getKey());
            }

        }
        return different;
    }

    public static void main(String[] args){
        Date date=new Date();
        java.sql.Date date1 = new java.sql.Date(date.getTime());
        Timestamp timestamp = new Timestamp(new Date().getTime());
        System.out.println(timestamp);
        System.out.println(date1);
    }
}
